package com.xiancheng;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author: LCG
 * 作者: LCG
 * 日期: 2021/2/25  11:02
 * 描述:
 */
public class MyRejectHandler implements RejectedExecutionHandler {

    private LinkedBlockingDeque linkedBlockingDeque;

    public MyRejectHandler(LinkedBlockingDeque linkedBlockingDeque) {

        this.linkedBlockingDeque=linkedBlockingDeque;

    }

    @Override
    public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {

        linkedBlockingDeque.add(r);

    }
}
